<?php
namespace lib\src;

use \lib\src\config;

class route{
	/**
	 * 获取当前路由信息
	 */
	public static function getRoute(){
		//host
		$host = $_SERVER['PHP_SELF'];
		//arr
		$hostArr = explode("/", $host);
		//sHostArr
		$sHostArr = array_reverse($hostArr);
		//head
		$head = explode(".",$sHostArr[0]);
		//判断
		$judgArr = explode(".php", $host);
		if(empty(end($judgArr))){
			return "index/welcome";
		}else{
			//retrun
			return $sHostArr[1]."/".$head[0];
		}
	}
	/**
	 * 根据当前路由调度控制器
	 */
	public static function useCont(){
		$config = config::getConfig("smarty");
		$route = self::getRoute();
		$conArr = explode("/",$route);
		return $conArr;
	}
}
?>